package com.swsc.ai.enums;

public enum TaskModeEnum {
    //测试模式
    SQL("sql", 1), //
    RDD("rdd", 2);

    private String name;
    private int index;

    // 构造方法
    private TaskModeEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public int getIndex() {
        return index;
    }

    public static TaskModeEnum fromTypeName(String typeName) {
        for (TaskModeEnum mode : TaskModeEnum.values()) {
            if (mode.getName().equals(typeName)) {
                return mode;
            }
        }
        return null;
    }

    //覆盖方法
    @Override
    public String toString() {
        return this.index + "_" + this.name;
    }
}
